package core;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Scanner;

import fileoperation.FileReader;
import sha1.*;
import commander.*;
import gitobject.*;
import fileoperation.*;
import core.*;
import repository.Repository;

public class Test {
    public static void main(String[] args) {
       /*
        *仓库repository测试
        */

        try{
            /*
             *仓库repository测试
             */

            new JitInit().init("C:/Users/之靈/Desktop/Git");
            new init().init();


            /*
             *测试add
             */
            new add().add("test.txt");
            new add().add("test101.txt");
            new add().add("test2");

            /*
             *读取index
             */
            String indexPath = Repository.getGitDir() + File.separator + "index";
            File index = new File(indexPath);


            /*
             *测试rm
             */
            System.out.println(FileReader.readFileValue(index));
            new rm().rm("test101.txt");
            System.out.println(FileReader.readFileValue(index));

            /*
             *测试commit及log
             */
            new  log().printlog();
            new commit().commit("polaris2","ava2","asd2");
            new commit().commit("polaris3","ava3","asd3");
            new  log().printlog();
            System.out.println(FileReader.readFileValue(index));

            /*
             *测试reset
             */
            new reset().resetMixed();
            System.out.println(FileReader.readFileValue(index));



            /*
             *测试branch
             */
            new branch().branch();
            new branch().branch("test");
            new branch().branch();
            new branch().branch("master2");
            new branch().branch();
          //  new branch().branch_d("test");

            new branch().branch();

            /*
             *测试checkout
             */
            new checkout().checkout("master2");
            new branch().branch();
            new checkout().checkout_b(  "master3");
            new branch().branch();
            /*
             *序列化及反序列化测试
             */


        }
        catch (Exception e) {
            e.printStackTrace();
        }

    }
}
